//    Copyright (C) Kherty.  All rights reserved.
using System.Windows.Media;
using OpenLS.Core.Serialization;

namespace OpenLS.Drawing
{
    internal class Path2DLineTo : PathElement
    {
        private AdjPoint2D pt;

        public AdjPoint2D Point
        {
            get { return pt; }
            set { pt = value; }
        }

        public override PathSegment Segment
        {
            get { return new LineSegment(Point.ToPoint(), true); }
        }


        internal override void ReadXmlCore(ReadContext context)
        {
            using (var c = context.Read("lnTo"))
            {
                Point = c.ReadElementAs<AdjPoint2D>("pt");
            }
        }

        internal override void WriteXmlCore(WriteContext context)
        {
            using (WriteContext c = context.Write("lnTo"))
            {
                c.WriteElementAs(Point, "pt");
            }
        }
    }
}